package fhp.hlhj.giantfold.module

import com.lzy.okgo.model.HttpParams
import fhp.hlhj.giantfold.Contents
import fhp.hlhj.giantfold.javaBean.ErroBean
import fhp.hlhj.giantfold.javaBean.TypesBean
import fhp.hlhj.giantfold.network.UrlApis
import fhp.hlhj.giantfold.network.Urls
import fhp.hlhj.giantfold.utils.LogUtil

/**
 * author: FHP
 * data: on 2017\12\4 0004 15:52
 * E-Mail: 103945089@qq.com
 */
class SuperMarketModule {
    interface IsOverListener{
        fun showloading()
        fun over(typesBean: TypesBean)
        fun error(erroBean: ErroBean)
    }
    fun getTypes(isOverListener: IsOverListener){
        val params = HttpParams()
        params.put("appkey",Contents.TKAPPKEY)
        UrlApis.getType(params)
                .doOnSubscribe {
                    isOverListener.showloading()
                }
                .subscribe ({
                    data->
                    LogUtil.log("data是否为空"+(data==null))
                    isOverListener.over(data)
                })
    }
}